<!DOCTYPE html>
<html lang="en">
<head>
    <include file="Public:header2" />
    <script type="text/javascript" src="__PUBLIC__/layer/layer.js"></script>
    <script type="text/javascript" src="__PUBLIC__/Home/js/jquery.cookies.2.2.0.js"></script>
</head>
<link rel="stylesheet" href="__PUBLIC__/intel/css/intlTelInput.css">
<script src="__PUBLIC__/intel/js/intlTelInput.js"></script>
<style type="text/css">
.intl-tel-input.separate-dial-code .selected-dial-code{color:#fff;font-size: 0.8rem;}
</style>
<body class="blackbg">
    <div id="container" class="logbg">
        <div class="log_title">
            <span class="back"><a href="javascript:history.go(-1)"></a></span>
            {:L('设置交易密码')}
        </div>
        <div class="logbot">
            <form>
                <input type="text" placeholder="{:L('手机号码')}" class="logipt"  id="username" name="username" >
                <div class="yzmbox">
                    <input type="text" placeholder="{:L('验证码')}" class="logipt yzmipt"  id="verify" name="code" >
                    <img id="codeImg" src="{:U('Verify/code')}" width="145" height="42" onclick="this.src=this.src+'?t='+Math.random()" style=" cursor: pointer;" title="{:L('换一张')}">
                </div>
                <div class="yzmbox">
                    <input type="text" placeholder="{:L('手机验证码')}" class="logipt yzmipt" id="moble_verify" name="code">
                    <input type="button" value="{:L('获取验证码')}" class="phonebut" onclick="SendCode()"  id="regBtn" style="background:#ff9900;color:#fff;">
              <!--    </div>
                <select id="mibao_question" class="logipt">
                     <option value="">{:L('请选择密保问题')}</option>
                    <option value="{:L('你父亲的姓名')}">{:L('你父亲的姓名')}</option>
                    <option value="{:L('你母亲的姓名')}">{:L('你母亲的姓名')}</option>
                    <option value="{:L('你爱人的姓名')}">{:L('你爱人的姓名')}</option>
                    <option value="{:L('你的出生日期')}">{:L('你的出生日期')}</option>
                    <option value="{:L('你父亲的出生日期')}">{:L('你父亲的出生日期')}</option>
                    <option value="{:L('你母亲的出生日期')}">{:L('你母亲的出生日期')}</option>
                    <option value="{:L('你爱人的出生日期')}">{:L('你爱人的出生日期')}</option>
                </select>
                <input type="text" id="mibao_answer" class="logipt" placeholder="{:L('answers_to_questions')}"/>-->

                <input type="password" placeholder="{:L('交易密码')}" class="logipt" id="password" name="password" >
                <input type="password" placeholder="{:L('确认交易密码')}" class="logipt"  id="repassword" name="password" >
                <input type="button" class="logbut" value="{:L('设置交易密码')}" onclick="Update();">
            </form>
        </div>
    </div>
    <script type="text/javascript">
   $("#username").intlTelInput({
      allowDropdown: true,
      // autoHideDialCode: true,
      // autoPlaceholder: "off",
      dropdownContainer: "body",
      // excludeCountries: ["us"],
      // formatOnDisplay: true,
      // geoIpLookup: function(callback) {
      //   $.get("http://ipinfo.io", function() {}, "jsonp").always(function(resp) {
      //     var countryCode = (resp && resp.country) ? resp.country : "";
      //     callback(countryCode);
      //   });
      // },
      initialCountry: "cn",
      nationalMode: true,
      // onlyCountries: ['us', 'fr', 'ca', 'jp','kr','de','cn','ru'],
      // placeholderNumberType: "MOBILE",
      // preferredCountries: ['cn', 'jp'],
      separateDialCode: true,
      utilsScript: "/Public/intel/js/utils.js"
    });

</script>
<script>
    function SendCode(){
        var username=$("#username").val();
        var moble=$("#username").val();
        var verify=$("#verify").val();
        if(username==""||username==null){
            layer.tips('{:L('请输入手机号码')}','#username',{tips:3});
            return false;
        }
        // if(moble==""||moble==null){
        //     layer.tips('请输入手机号码','#moble',{tips:3});
        //     return false;
        // }
        if(verify==""||verify==null){
            layer.tips('{:L('请输入图形验证码')}','#verify',{tips:3});
            return false;
        }

		layer.load(0, {shade: [0.5,'#8F8F8F']});
        $('#regBtn').attr("disabled","disabled");
        $.post("{:U('Verify/findpaypwd')}",{username:username,mobile:moble,verify:verify},function(data){
			layer.closeAll();
            if(data.status==1){
                layer.msg(data.info,{icon:1});
                var obj=$('#regBtn');
                var wait=120;
                var interval=setInterval(function(){
                    obj.css('backgroundColor','#999B9C');
                    obj.val(wait+'秒后再次发送');
                    wait--;
                    if(wait<0){
                        $('#regBtn').removeAttr("disabled");
                        clearInterval(interval);
                        obj.val('获取验证码');
                        obj.css('backgroundColor','#0096e0');
                    }
                    ;
                },1000);
            }else{
                $('#regBtn').removeAttr("disabled");
                layer.msg(data.info,{icon:2});
            }
        },"json");
    }
    function Update(){
        var username=$("#username").val();
        var moble=$("#username").val();
        var moble_verify=$("#moble_verify").val();
        var verify=$("#verify").val();
      //  var mibao_question=$("#mibao_question").val();
       // var mibao_answer=$("#mibao_answer").val();
        var password=$("#password").val();
        var repassword=$("#repassword").val();
        if(username==""||username==null){
            layer.tips('{:L('请输入手机号码')}','#username',{tips:3});
            return false;
        }
        // if(moble==""||moble==null){
        //     layer.tips('请输入手机号码','#moble',{tips:3});
        //     return false;
        // }
        if(moble_verify==""||moble_verify==null){
            layer.tips('{:L('请输入手机验证码')}','#moble_verify',{tips:3});
            return false;
        }
        if(verify==""||verify==null){
            layer.tips('{:L('请输入图形验证码')}','#verify',{tips:3});
            return false;
        }
      //  if(mibao_question==""||mibao_question==null){
       //     layer.tips('{:L('请选择密保问题')}','#mibao_question',{tips:3});
       //     return false;
     //   }
       // if(mibao_answer==""||mibao_answer==null){
       //     layer.tips('{:L('请输入密保问题答案')}','#mibao_answer',{tips:3});
       //     return false;
     //   }
        if(password==""||password==null){
            layer.tips('{:L('请输入交易密码')}','#password',{tips:3});
            return false;
        }
        if(repassword==""||repassword==null){
            layer.tips('{:L('请确认交易密码')}','#repassword',{tips:3});
            return false;
        }
        if(password!=repassword){
            layer.tips('{:L('两次输入的交易密码不一致！')}','#repassword',{tips:3});
            return false;
        }
        $.post("{:U('Login/findpaypwd')}",{username:username,mobile:moble,mobile_verify:moble_verify,verify:verify,password:password,repassword:repassword},function(data){
            if(data.status==1){
                layer.msg(data.info,{icon:1});
                window.setTimeout("window.location='/'",1000);
            }else{
                layer.msg(data.info,{icon:2});
            }
        },"json");
    }
</script>
</body>
</html>